package com.aspose.cells;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

final class zbty {
   static void a(zig var0) {
      zbcs var1 = var0.z();
      Iterator var2 = var1.iterator();

      while(true) {
         zbcq var3;
         do {
            if (!var2.hasNext()) {
               return;
            }

            var3 = (zbcq)var2.next();
         } while(var3.G().getCount() == 0);

         zbp var4;
         if (var3.j()) {
            var4 = var0.g();
         } else {
            var4 = var0.e();
         }

         for(int var5 = 0; var5 < var3.G().getCount(); ++var5) {
            Object var6 = null;
            Object var7 = null;
            double[][] var8 = new double[][]{(double[])var7};
            double[][] var9 = new double[][]{(double[])var6};
            a(var3, var4, var8, var9);
            double[] var13 = var8[0];
            double[] var12 = var9[0];
            double var14 = 0.0D;
            zbtu var10 = var3.G().c(var5);
            if (var10.d().g() && var12.length >= 2 && var13.length >= 2) {
               double[] var11;
               switch(var10.q()) {
               case 0:
                  var11 = new double[]{var14};
                  var10.a(b(var13, var12, var10.j(), var10.i(), var11));
                  var14 = var11[0];
                  break;
               case 1:
                  var11 = new double[]{var14};
                  var10.a(a(var13, var12, var10.j(), var10.i(), var11));
                  var14 = var11[0];
                  break;
               case 2:
                  var11 = new double[]{var14};
                  var10.a(b(var13, var12, var11));
                  var14 = var11[0];
               case 3:
               default:
                  break;
               case 4:
                  var11 = new double[]{var14};
                  var10.a(a(var13, var12, var10.o(), var10.j(), var10.i(), var11));
                  var14 = var11[0];
                  break;
               case 5:
                  var11 = new double[]{var14};
                  var10.a(a(var13, var12, var11));
                  var14 = var11[0];
               }

               var10.d(var14);
            }
         }
      }
   }

   static void a(zn var0, zbcq var1, com.aspose.cells.b.a.b.zp var2, float var3, double var4) {
      if (!zbuk.a(var2)) {
         com.aspose.cells.b.a.b.a.zf var6 = var0.e();
         var0.a(var2);

         for(int var7 = 0; var7 < var1.G().getCount(); ++var7) {
            zbtu var8 = var1.G().c(var7);
            if (var8.d().g()) {
               switch(var8.q()) {
               case 0:
               case 2:
               case 4:
               case 5:
                  if (a(var8.s())) {
                     b(var0, var1, var2, var3, var4, var8);
                  }
                  break;
               case 1:
                  if (a(var8.s())) {
                     a(var0, var1, var2, var3, var4, var8);
                  }
                  break;
               case 3:
                  c(var0, var1, var2, var3, var4, var8);
               }
            }
         }

         var0.a(var6);
      }
   }

   private static void a(zn var0, zbcq var1, com.aspose.cells.b.a.b.zp var2, float var3, double var4, zbtu var6) {
      if (var6.d().g()) {
         zig var7 = var1.v();
         int var10 = var1.ag();
         zbp var8;
         zbp var9;
         if (var10 == 1) {
            var9 = var7.e();
            var8 = var7.G();
         } else {
            var9 = var7.g();
            var8 = var7.I();
         }

         double var11 = 0.0D;
         double var13 = 0.0D;
         double[] var15 = new double[]{var11};
         double[] var16 = new double[]{var13};
         a(var1, var6, var15, var16);
         var11 = var15[0];
         var13 = var16[0];
         double var17 = var8.n() ? var8.g(var8.D()) : var8.D();
         double var19 = var8.n() ? var8.g(var8.z()) : var8.z();
         var4 = var8.n() ? var8.g(var4) : var4;
         double var21 = 0.0D;
         double var27 = var9.n() ? var9.g(var9.x()) : var9.x();
         double var29 = var9.n() ? var9.g(var9.z()) : var9.z();
         double var31 = var9.n() ? var9.g(var9.D()) : var9.D();
         if (var9.k() == 2) {
            var27 = (double)zbr.a(1, var9.y(), (int)var9.x(), 0, var1.v().X());
         }

         double var23;
         double var25;
         if (!var9.f() && !var7.u()) {
            var21 = var29 - var31;
            var23 = var11 - var31;
            var25 = var13 - var31;
         } else {
            var21 = var29 - var31 + var27;
            var23 = var11 - var31 + var27 / 2.0D;
            var25 = var13 - var31 + var27 - var27 / 2.0D;
         }

         double var33 = (double)var2.e() / var21;
         double var35 = var23 * var33;
         if (var9.p()) {
            var35 = (double)var2.i() - var35;
         } else {
            var35 += (double)var2.g();
         }

         double var37 = (double)var3;
         double var39 = a(var6, var11);
         double var41 = (var39 - var4) / (var19 - var17) * (double)var2.f();
         if (!var8.p()) {
            var37 -= var41;
         } else {
            var37 += var41;
         }

         double var43 = var25 * var33;
         if (var9.p()) {
            var43 = (double)var2.i() - var43;
         } else {
            var43 += (double)var2.g();
         }

         double var45 = (double)var3;
         double var47 = a(var6, var13);
         double var49 = (var47 - var4) / (var19 - var17) * (double)var2.f();
         if (!var8.p()) {
            var45 -= var49;
         } else {
            var45 += var49;
         }

         var6.d().a((float)var35, (float)var37, (float)var43, (float)var45);
         var6.a = new com.aspose.cells.b.a.b.zo((float)var43, (float)var45);
      }
   }

   private static void b(zn var0, zbcq var1, com.aspose.cells.b.a.b.zp var2, float var3, double var4, zbtu var6) {
      if (var6.d().g()) {
         zig var7 = var1.v();
         int var10 = var1.ag();
         zbp var8;
         zbp var9;
         if (var10 == 1) {
            var9 = var7.e();
            var8 = var7.G();
         } else {
            var9 = var7.g();
            var8 = var7.I();
         }

         double var11 = var8.n() ? var8.g(var8.D()) : var8.D();
         double var13 = var8.n() ? var8.g(var8.z()) : var8.z();
         var4 = var8.n() ? var8.g(var4) : var4;
         double var15 = 0.0D;
         double var17 = 0.0D;
         double[] var19 = new double[]{var15};
         double[] var20 = new double[]{var17};
         a(var1, var6, var19, var20);
         var15 = var19[0];
         var17 = var20[0];
         double var21 = 0.0D;
         double var23 = var9.n() ? var9.g(var9.x()) : var9.x();
         double var25 = var9.n() ? var9.g(var9.z()) : var9.z();
         double var27 = var9.n() ? var9.g(var9.D()) : var9.D();
         if (var9.k() == 2) {
            var23 = (double)zbr.a(1, var9.y(), (int)var9.x(), 0, var1.v().X());
         }

         if (!var9.f() && !var7.u()) {
            var21 = var25 - var27;
         } else {
            var21 = var25 - var27 + var23;
         }

         ArrayList var29 = new ArrayList();
         double var30 = var21 / (double)var2.e();
         double var32 = var15 < var27 ? var27 : var15;
         double var34 = var17 > var25 ? var25 : var17;

         for(double var36 = var32; var36 <= var34; var36 += var30) {
            double var38;
            if (!var9.f() && !var7.u()) {
               var38 = (var36 - var27) * (double)var2.e() / var21;
            } else {
               var38 = (var36 - var27 + var23 / 2.0D) * (double)var2.e() / var21;
            }

            if (var9.p()) {
               var38 = (double)var2.i() - var38;
            } else {
               var38 += (double)var2.g();
            }

            double var40 = (double)var3;
            double var42 = a(var6, var36);
            double var44 = (var42 - var4) / (var13 - var11) * (double)var2.f();
            if (!var8.p()) {
               var40 -= var44;
            } else {
               var40 += var44;
            }

            com.aspose.cells.b.a.b.zo var46 = new com.aspose.cells.b.a.b.zo((float)var38, (float)var40);
            var29.add(var46);
         }

         a(var0, var29, var6, true);
         if (var29.size() > 0) {
            var6.a = (com.aspose.cells.b.a.b.zo)var29.get(var29.size() - 1);
         }

      }
   }

   private static void c(zn var0, zbcq var1, com.aspose.cells.b.a.b.zp var2, float var3, double var4, zbtu var6) {
      if (var6.d().g()) {
         zig var7 = var1.v();
         int var10 = var1.ag();
         zbp var8;
         zbp var9;
         if (var10 == 1) {
            var9 = var7.e();
            var8 = var7.G();
         } else {
            var9 = var7.g();
            var8 = var7.I();
         }

         double var11 = var8.n() ? var8.g(var8.D()) : var8.D();
         double var13 = var8.n() ? var8.g(var8.z()) : var8.z();
         var4 = var8.n() ? var8.g(var4) : var4;
         double var15 = 0.0D;
         double var17 = 0.0D;
         double[] var19 = new double[]{var15};
         double[] var20 = new double[]{var17};
         a(var1, var6, var19, var20);
         var15 = var19[0];
         var17 = var20[0];
         double var21 = 0.0D;
         double var23 = var9.n() ? var9.g(var9.x()) : var9.x();
         double var25 = var9.n() ? var9.g(var9.z()) : var9.z();
         double var27 = var9.n() ? var9.g(var9.D()) : var9.D();
         if (var9.k() == 2) {
            var23 = (double)zbr.a(1, var9.y(), (int)var9.x(), 0, var1.v().X());
         }

         if (!var9.f() && !var7.u()) {
            var21 = var25 - var27;
         } else {
            var21 = var25 - var27 + var23;
         }

         double var29 = (double)var2.e() / var21;
         ArrayList var31 = new ArrayList();
         zjg var32 = var1.E();
         ArrayList var33 = var32.d();

         for(int var34 = var6.p() - 1; var34 < var33.size(); ++var34) {
            zje var35 = (zje)var33.get(var34);
            double var36 = 0.0D;
            double[] var38 = new double[]{var36};
            boolean var39 = a(var34, var6.p(), var33, var38);
            var36 = var38[0];
            if (!var39) {
               double var40;
               if (!var9.f() && !var7.u()) {
                  var40 = (var35.q() - var27) * var29;
               } else {
                  var40 = (var35.q() - var27 + var23 / 2.0D) * var29;
               }

               if (var9.p()) {
                  var40 = (double)var2.i() - var40;
               } else {
                  var40 += (double)var2.g();
               }

               double var42 = (double)var3;
               double var44 = (var36 - var4) / (var13 - var11) * (double)var2.f();
               if (!var8.p()) {
                  var42 -= var44;
               } else {
                  var42 += var44;
               }

               com.aspose.cells.b.a.b.zo var46 = new com.aspose.cells.b.a.b.zo((float)var40, (float)var42);
               var31.add(var46);
            }
         }

         a(var0, var31, var6, false);
      }
   }

   static void b(zn var0, zbcq var1, com.aspose.cells.b.a.b.zp var2, float var3, double var4) {
      if (!zbuk.a(var2)) {
         com.aspose.cells.b.a.b.a.zf var6 = var0.e();
         var0.a(var2);

         for(int var7 = 0; var7 < var1.G().getCount(); ++var7) {
            zbtu var8 = var1.G().c(var7);
            if (var8.d().g() && a(var8.s())) {
               switch(var8.q()) {
               case 0:
               case 2:
               case 4:
               case 5:
                  e(var0, var1, var2, var3, var4, var8);
                  break;
               case 1:
                  d(var0, var1, var2, var3, var4, var8);
                  break;
               case 3:
                  f(var0, var1, var2, var3, var4, var8);
               }
            }
         }

         var0.a(var6);
      }
   }

   private static void d(zn var0, zbcq var1, com.aspose.cells.b.a.b.zp var2, float var3, double var4, zbtu var6) {
      if (var6.d().g()) {
         zig var7 = var1.v();
         int var10 = var1.ag();
         zbp var8;
         zbp var9;
         if (var10 == 1) {
            var9 = var7.e();
            var8 = var7.G();
         } else {
            var9 = var7.g();
            var8 = var7.I();
         }

         double var11 = 0.0D;
         double var13 = 0.0D;
         double[] var15 = new double[]{var11};
         double[] var16 = new double[]{var13};
         a(var1, var6, var15, var16);
         var11 = var15[0];
         var13 = var16[0];
         double var17 = var8.n() ? var8.g(var8.D()) : var8.D();
         double var19 = var8.n() ? var8.g(var8.z()) : var8.z();
         var4 = var8.n() ? var8.g(var4) : var4;
         double var21 = 0.0D;
         double var27 = var9.n() ? var9.g(var9.x()) : var9.x();
         double var29 = var9.n() ? var9.g(var9.z()) : var9.z();
         double var31 = var9.n() ? var9.g(var9.D()) : var9.D();
         if (var9.k() == 2) {
            var27 = (double)zbr.a(1, var9.y(), (int)var9.x(), 0, var1.v().X());
         }

         double var23;
         double var25;
         if (!var9.f() && !var7.u()) {
            var21 = var29 - var31;
            var23 = var11 - var31;
            var25 = var13 - var31;
         } else {
            var21 = var29 - var31 + var27;
            var23 = var11 - var31 + var27 / 2.0D;
            var25 = var13 - var31 + var27 - var27 / 2.0D;
         }

         double var33 = (double)var2.f() / var21;
         double var35 = var23 * var33;
         if (!var9.p()) {
            var35 = (double)var2.j() - var35;
         } else {
            var35 += (double)var2.h();
         }

         double var37 = (double)var3;
         double var39 = a(var6, var11);
         double var41 = (var39 - var4) / (var19 - var17) * (double)var2.e();
         if (!var8.p()) {
            var37 += var41;
         } else {
            var37 -= var41;
         }

         double var43 = var25 * var33;
         if (!var9.p()) {
            var43 = (double)var2.j() - var43;
         } else {
            var43 += (double)var2.h();
         }

         double var45 = (double)var3;
         double var47 = a(var6, var13);
         double var49 = (var47 - var4) / (var19 - var17) * (double)var2.e();
         if (!var8.p()) {
            var45 += var49;
         } else {
            var45 -= var49;
         }

         var6.d().a((float)var37, (float)var35, (float)var45, (float)var43);
         var6.a = new com.aspose.cells.b.a.b.zo((float)var45, (float)var43);
      }
   }

   private static void e(zn var0, zbcq var1, com.aspose.cells.b.a.b.zp var2, float var3, double var4, zbtu var6) {
      if (var6.d().g()) {
         zig var7 = var1.v();
         int var10 = var1.ag();
         zbp var8;
         zbp var9;
         if (var10 == 1) {
            var9 = var7.e();
            var8 = var7.G();
         } else {
            var9 = var7.g();
            var8 = var7.I();
         }

         double var11 = var8.n() ? var8.g(var8.D()) : var8.D();
         double var13 = var8.n() ? var8.g(var8.z()) : var8.z();
         var4 = var8.n() ? var8.g(var4) : var4;
         double var15 = 0.0D;
         double var17 = 0.0D;
         double[] var19 = new double[]{var15};
         double[] var20 = new double[]{var17};
         a(var1, var6, var19, var20);
         var15 = var19[0];
         var17 = var20[0];
         double var21 = 0.0D;
         double var23 = var9.n() ? var9.g(var9.x()) : var9.x();
         double var25 = var9.n() ? var9.g(var9.z()) : var9.z();
         double var27 = var9.n() ? var9.g(var9.D()) : var9.D();
         if (var9.k() == 2) {
            var23 = (double)zbr.a(1, var9.y(), (int)var9.x(), 0, var1.v().X());
         }

         if (!var9.f() && !var7.u()) {
            var21 = var25 - var27;
         } else {
            var21 = var25 - var27 + var23;
         }

         ArrayList var29 = new ArrayList();
         double var30 = var21 / (double)var2.f();

         for(double var32 = var15; var32 <= var17; var32 += var30) {
            double var34;
            if (!var9.f() && !var7.u()) {
               var34 = (var32 - var27) * (double)var2.f() / var21;
            } else {
               var34 = (var32 - var27 + var23 / 2.0D) * (double)var2.f() / var21;
            }

            if (!var9.p()) {
               var34 = (double)var2.j() - var34;
            } else {
               var34 += (double)var2.h();
            }

            double var36 = (double)var3;
            double var38 = a(var6, var32);
            double var40 = (var38 - var4) / (var13 - var11) * (double)var2.e();
            if (!var8.p()) {
               var36 += var40;
            } else {
               var36 -= var40;
            }

            com.aspose.cells.b.a.b.zo var42 = new com.aspose.cells.b.a.b.zo((float)var36, (float)var34);
            var29.add(var42);
         }

         a(var0, var29, var6, true);
         if (var29.size() > 0) {
            var6.a = (com.aspose.cells.b.a.b.zo)var29.get(var29.size() - 1);
         }

      }
   }

   private static void f(zn var0, zbcq var1, com.aspose.cells.b.a.b.zp var2, float var3, double var4, zbtu var6) {
      if (var6.d().g()) {
         zig var7 = var1.v();
         int var10 = var1.ag();
         zbp var8;
         zbp var9;
         if (var10 == 1) {
            var9 = var7.e();
            var8 = var7.G();
         } else {
            var9 = var7.g();
            var8 = var7.I();
         }

         double var11 = var8.n() ? var8.g(var8.D()) : var8.D();
         double var13 = var8.n() ? var8.g(var8.z()) : var8.z();
         var4 = var8.n() ? var8.g(var4) : var4;
         double var15 = 0.0D;
         double var17 = 0.0D;
         double[] var19 = new double[]{var15};
         double[] var20 = new double[]{var17};
         a(var1, var6, var19, var20);
         var15 = var19[0];
         var17 = var20[0];
         double var21 = 0.0D;
         double var23 = var9.n() ? var9.g(var9.x()) : var9.x();
         double var25 = var9.n() ? var9.g(var9.z()) : var9.z();
         double var27 = var9.n() ? var9.g(var9.D()) : var9.D();
         if (var9.k() == 2) {
            var23 = (double)zbr.a(1, var9.y(), (int)var9.x(), 0, var1.v().X());
         }

         if (!var9.f() && !var7.u()) {
            var21 = var25 - var27;
         } else {
            var21 = var25 - var27 + var23;
         }

         double var29 = (double)var2.f() / var21;
         ArrayList var31 = new ArrayList();
         zjg var32 = var1.E();
         ArrayList var33 = var32.d();

         for(int var34 = var6.p() - 1; var34 < var33.size(); ++var34) {
            zje var35 = (zje)var33.get(var34);
            double var36 = 0.0D;
            double[] var38 = new double[]{var36};
            boolean var39 = a(var34, var6.p(), var33, var38);
            var36 = var38[0];
            if (!var39) {
               double var40;
               if (!var9.f() && !var7.u()) {
                  var40 = (var35.q() - var27) * var29;
               } else {
                  var40 = (var35.q() - var27 + var23 / 2.0D) * var29;
               }

               if (!var9.p()) {
                  var40 = (double)var2.j() - var40;
               } else {
                  var40 += (double)var2.h();
               }

               double var42 = (double)var3;
               double var44 = (var36 - var4) / (var13 - var11) * (double)var2.e();
               if (!var8.p()) {
                  var42 += var44;
               } else {
                  var42 -= var44;
               }

               com.aspose.cells.b.a.b.zo var46 = new com.aspose.cells.b.a.b.zo((float)var42, (float)var40);
               var31.add(var46);
            }
         }

         a(var0, var31, var6, false);
      }
   }

   private static boolean a(int var0, int var1, ArrayList var2, double[] var3) {
      double var4 = 0.0D;
      int var6 = 0;

      for(int var7 = var0 - var1 + 1; var7 <= var0; ++var7) {
         zje var8 = (zje)var2.get(var7);
         if (var8 != null && !var8.a()) {
            var4 += var8.v();
         } else {
            ++var6;
         }
      }

      if (var1 == var6) {
         var3[0] = 0.0D;
         return true;
      } else {
         var3[0] = var4 / (double)(var1 - var6);
         return false;
      }
   }

   private static double a(zbtu var0, double var1) {
      double[] var3 = var0.s();
      switch(var0.q()) {
      case 0:
         return var3[1] * Math.pow(2.718281828459045D, var3[0] * var1);
      case 1:
         return var3[0] * var1 + var3[1];
      case 2:
         return var3[0] * Math.log(var1) + var3[1];
      case 3:
      default:
         return 0.0D;
      case 4:
         double var4 = 0.0D;

         for(int var6 = 0; var6 < var3.length; ++var6) {
            var4 += var3[var6] * Math.pow(var1, (double)(var3.length - 1 - var6));
         }

         return var4;
      case 5:
         return var3[1] * Math.pow(var1, var3[0]);
      }
   }

   static void a(zn var0, List var1, zbtu var2, boolean var3) {
      com.aspose.cells.b.a.b.zo[] var4 = new com.aspose.cells.b.a.b.zo[var1.size()];
      zbuk.a(var4);
      com.aspose.cells.a.e.ze.a((Collection)var1, (Object[])var4, 0);
      if (var4.length > 1) {
         com.aspose.cells.b.a.b.a.ze var5 = new com.aspose.cells.b.a.b.a.ze();
         if (var3) {
            var5.c(var4);
         } else {
            var5.a(var4);
         }

         var2.d().a(var5);
      }

   }

   private static void a(zbcq var0, zbp var1, double[][] var2, double[][] var3) {
      double var4 = 2.147483647E9D;

      int var6;
      for(var6 = 0; var6 < var0.E().getCount(); ++var6) {
         zje var7 = var0.E().b(var6);
         if (var7 != null && !var7.a() && !var7.b() && var7.q() < var4) {
            var4 = var7.q();
         }
      }

      var6 = var0.E().getCount();

      int var10;
      for(var10 = 0; var10 < var0.E().getCount(); ++var10) {
         zje var8 = var0.E().b(var10);
         if (var8 == null || var8.a() || var8.b()) {
            --var6;
         }
      }

      var2[0] = new double[var6];
      var3[0] = new double[var6];
      var10 = 0;

      for(int var11 = 0; var11 < var0.E().getCount(); ++var11) {
         zje var9 = var0.E().b(var11);
         if (var9 != null && !var9.a() && !var9.b()) {
            var2[0][var10] = var9.v();
            if (var9.b()) {
               var3[0][var10] = var4;
            } else {
               var3[0][var10] = var9.q();
            }

            ++var10;
         }
      }

   }

   private static void a(zbcq var0, zbtu var1, double[] var2, double[] var3) {
      var2[0] = 2.147483647E9D;
      var3[0] = -2.147483648E9D;
      zjg var4 = var0.E();
      boolean var5 = true;

      for(int var6 = 0; var6 < var4.getCount(); ++var6) {
         if (var4.a(var6) != null && !var4.a(var6).b()) {
            double var7 = var4.a(var6).q();
            if (var5) {
               var2[0] = var7;
               var3[0] = var7;
               var5 = false;
            }

            if (var7 < var2[0]) {
               var2[0] = var7;
            }

            if (var7 > var3[0]) {
               var3[0] = var7;
            }
         }
      }

      if (var5) {
         var2[0] = 0.0D;
         var3[0] = 0.0D;
      }

      var2[0] -= var1.e();
      var3[0] += var1.h();
   }

   private static boolean a(double[] var0) {
      if (var0 == null) {
         return false;
      } else {
         double[] var1 = var0;
         int var2 = var0.length;

         for(int var3 = 0; var3 < var2; ++var3) {
            double var4 = var1[var3];
            if (Double.isNaN(var4)) {
               return false;
            }
         }

         return true;
      }
   }

   private static double[] a(double[] var0, double[] var1, boolean var2, double var3, double[] var5) {
      double[][] var6 = new double[var0.length][];

      for(int var7 = 0; var7 < var0.length; ++var7) {
         var6[var7] = new double[]{var1[var7]};
      }

      Object[][] var10 = (Object[][])null;
      if (var2) {
         for(int var8 = 0; var8 < var0.length; ++var8) {
            var0[var8] -= var3;
         }

         var10 = zanb.b(var0, var6);
      } else {
         var10 = zanb.a(var0, var6);
      }

      double[] var11 = new double[var10[0].length];

      for(int var9 = 0; var9 < var11.length; ++var9) {
         var11[var9] = (Double)var10[0][var9];
         if (var9 == var11.length - 1 && var2) {
            var11[var9] = var3;
         }
      }

      var5[0] = (Double)var10[2][0];
      return var11;
   }

   private static double[] a(double[] var0, double[] var1, int var2, boolean var3, double var4, double[] var6) {
      double[][] var7 = new double[var1.length][];
      if (var2 > var1.length - 1) {
         var2 = var1.length - 1;
      }

      int var9;
      for(int var8 = 0; var8 < var1.length; ++var8) {
         var7[var8] = new double[var2];
         var7[var8][0] = var1[var8];

         for(var9 = 1; var9 < var2; ++var9) {
            var7[var8][var9] = var1[var8] * var7[var8][var9 - 1];
         }
      }

      Object[][] var11 = (Object[][])null;
      if (var3) {
         for(var9 = 0; var9 < var0.length; ++var9) {
            var0[var9] -= var4;
         }

         var11 = zanb.b(var0, var7);
      } else {
         var11 = zanb.a(var0, var7);
      }

      double[] var12 = new double[var11[0].length];

      for(int var10 = 0; var10 < var12.length; ++var10) {
         var12[var10] = (Double)var11[0][var10];
         if (var10 == var12.length - 1 && var3) {
            var12[var10] = var4;
         }
      }

      var6[0] = (Double)var11[2][0];
      return var12;
   }

   private static double[] a(double[] var0, double[] var1, double[] var2) {
      for(int var3 = 0; var3 < var0.length; ++var3) {
         var0[var3] = Math.log(var0[var3]);
         var1[var3] = Math.log(var1[var3]);
      }

      double[] var4 = a(var0, var1, false, 0.0D, var2);
      var4[1] = Math.exp(var4[1]);
      return var4;
   }

   private static double[] b(double[] var0, double[] var1, double[] var2) {
      for(int var3 = 0; var3 < var0.length; ++var3) {
         var1[var3] = Math.log(var1[var3]);
      }

      double[] var4 = a(var0, var1, false, 0.0D, var2);
      return var4;
   }

   private static double[] b(double[] var0, double[] var1, boolean var2, double var3, double[] var5) {
      for(int var6 = 0; var6 < var0.length; ++var6) {
         var0[var6] = Math.log(var0[var6]);
      }

      double var9 = 0.0D;
      if (var2) {
         var9 = Math.log(var3);
      }

      double[] var8 = a(var0, var1, var2, var9, var5);
      if (var2) {
         var8[1] = var3;
      } else {
         var8[1] = Math.exp(var8[1]);
      }

      return var8;
   }

   static void a(zn var0, zbcq var1) throws Exception {
      boolean var2 = false;
      if (var1.ah() == 6 || var1.ah() == 7 || var1.ah() == 8) {
         var2 = true;
      }

      for(int var3 = 0; var3 < var1.G().getCount(); ++var3) {
         zbtu var4 = var1.G().c(var3);
         if (var4.d().g() && a(var4.s())) {
            String var5 = null;
            if (var4.r().s() == null) {
               ArrayList var30 = new ArrayList();
               ArrayList var31 = new ArrayList();
               if (var4.f()) {
                  double[] var32 = var4.s();
                  String[] var35 = a(var1.v(), var4.s(), var4);
                  switch(var4.q()) {
                  case 0:
                     var5 = "y = ";
                     if (var32[1] < 0.0D) {
                        var5 = var5 + " -";
                     }

                     if (Math.abs(var32[1]) == 1.0D) {
                        var5 = var5 + "e";
                     } else {
                        var5 = var5 + var35[1] + "e";
                     }

                     com.aspose.cells.b.a.a.ze.a(var30, (Object)var5);
                     var5 = "";
                     if (var32[0] < 0.0D) {
                        var5 = var5 + " -";
                     }

                     if (Math.abs(var32[0]) == 1.0D) {
                        var5 = var5 + "x";
                     } else {
                        var5 = var5 + var35[0] + "x";
                     }

                     com.aspose.cells.b.a.a.ze.a(var30, (Object)var5);
                     break;
                  case 1:
                     var5 = "y = ";
                     if (var32[0] < 0.0D) {
                        var5 = var5 + " -";
                     }

                     if (Math.abs(var32[0]) == 1.0D) {
                        var5 = var5 + "x";
                     } else {
                        var5 = var5 + var35[0] + "x";
                     }

                     if (var32[1] != 0.0D) {
                        if (var32[1] > 0.0D) {
                           var5 = var5 + " + ";
                        } else if (var32[1] < 0.0D) {
                           var5 = var5 + " - ";
                        }

                        var5 = var5 + var35[1];
                     }

                     com.aspose.cells.b.a.a.ze.a(var30, (Object)var5);
                     break;
                  case 2:
                     var5 = "y = ";
                     if (var32[0] < 0.0D) {
                        var5 = var5 + " -";
                     }

                     if (Math.abs(var32[0]) == 1.0D) {
                        var5 = var5 + "x";
                     } else {
                        var5 = var5 + var35[0] + "Ln(x)";
                     }

                     if (var32[1] != 0.0D) {
                        if (var32[1] > 0.0D) {
                           var5 = var5 + " + ";
                        } else if (var32[1] < 0.0D) {
                           var5 = var5 + " - ";
                        }

                        var5 = var5 + var35[1];
                        com.aspose.cells.b.a.a.ze.a(var30, (Object)var5);
                     }
                  case 3:
                  default:
                     break;
                  case 4:
                     var5 = "y = ";
                     if (var32[0] != 0.0D) {
                        if (var32[0] < 0.0D) {
                           var5 = var5 + " -";
                        }

                        if (Math.abs(var32[0]) == 1.0D) {
                           var5 = var5 + "x";
                        } else {
                           var5 = var5 + var35[0] + "x";
                        }

                        com.aspose.cells.b.a.a.ze.a(var30, (Object)var5);
                        com.aspose.cells.b.a.a.ze.a(var30, (Object)"2");
                     }

                     var5 = "";
                     if (var32[1] != 0.0D) {
                        if (var32[1] < 0.0D) {
                           var5 = var5 + " - ";
                        } else {
                           var5 = var5 + " + ";
                        }

                        if (Math.abs(var32[1]) == 1.0D) {
                           var5 = var5 + "x";
                        } else {
                           var5 = var5 + var35[1] + "x";
                        }
                     }

                     if (var32[2] != 0.0D) {
                        if (var32[2] > 0.0D) {
                           var5 = var5 + " + ";
                        } else if (var32[2] < 0.0D) {
                           var5 = var5 + " - ";
                        }

                        var5 = var5 + var35[2];
                     }

                     com.aspose.cells.b.a.a.ze.a(var30, (Object)var5);
                     break;
                  case 5:
                     var5 = "y = ";
                     if (var32[1] < 0.0D) {
                        var5 = var5 + " -";
                     }

                     if (Math.abs(var32[1]) == 1.0D) {
                        var5 = var5 + "x";
                     } else {
                        var5 = var5 + var35[1] + "x";
                     }

                     com.aspose.cells.b.a.a.ze.a(var30, (Object)var5);
                     var5 = "";
                     if (var32[0] < 0.0D) {
                        var5 = var5 + " -";
                     }

                     var5 = var5 + var35[0];
                     com.aspose.cells.b.a.a.ze.a(var30, (Object)var5);
                  }
               }

               String var37;
               if (var4.g()) {
                  var5 = "";
                  var5 = var5 + "R";
                  com.aspose.cells.b.a.a.ze.a(var31, (Object)var5);
                  com.aspose.cells.b.a.a.ze.a(var31, (Object)"2");
                  boolean var33 = true;
                  var37 = "0.0000";
                  if (!"".equals(var4.r().p())) {
                     var37 = var4.r().p();
                     var33 = false;
                     if (var37.toLowerCase().equals("general")) {
                        var37 = "0.0000";
                        var33 = true;
                     }
                  }

                  var5 = " = ";
                  String var36 = zgc.a(var1.v().al(), var4.t(), var37);
                  if (var33) {
                     double var38 = zbuk.a(var36, var1.v().al());
                     if (var38 == 0.0D) {
                        var36 = com.aspose.cells.a.c.zp.a(var4.t(), "0.00E+00");
                        String[] var13 = com.aspose.cells.b.a.zv.d(var36, 'E');
                        if (var13.length > 1) {
                           var36 = a(var13[0]) + "E";

                           for(int var14 = 1; var14 < var13.length; ++var14) {
                              var36 = var36 + var13[var14];
                           }
                        }
                     } else {
                        var36 = a(var36);
                     }
                  }

                  var5 = var5 + var36;
                  com.aspose.cells.b.a.a.ze.a(var31, (Object)var5);
               }

               String var34 = "";

               for(int var40 = 0; var40 < var30.size(); ++var40) {
                  var34 = var34 + (String)var30.get(var40);
               }

               var37 = "";

               for(int var41 = 0; var41 < var31.size(); ++var41) {
                  var37 = var37 + (String)var31.get(var41);
               }

               if (!"".equals(var34) || !"".equals(var37)) {
                  zpu var43 = var4.r();
                  var43.c(var34 + "\n" + var37);
                  com.aspose.cells.b.a.b.zg var39 = new com.aspose.cells.b.a.b.zg(var43.a().h().b(), var43.a().h().h() * 0.7F);
                  com.aspose.cells.b.a.b.zt var12 = new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);
                  if (var30.size() > 0) {
                     if (var30.size() == 1) {
                        var12 = zbsq.b(var0, var34, var43.a().h());
                     } else {
                        String var42 = (String)var30.get(0);
                        com.aspose.cells.b.a.b.zt var45 = zbsq.b(var0, var42, var43.a().h());
                        var12.a(var12.b() + var45.b());
                        var12.b(var12.c() + var45.c());
                        String var15 = (String)var30.get(1);
                        com.aspose.cells.b.a.b.zt var16 = zbsq.b(var0, var15, var39);
                        var12.a(var12.b() + var16.b());
                        if (var30.size() > 2) {
                           String var17 = (String)var30.get(2);
                           com.aspose.cells.b.a.b.zt var18 = zbsq.b(var0, var17, var43.a().h());
                           var12.a(var12.b() + var18.b());
                        }
                     }
                  }

                  com.aspose.cells.b.a.b.zt var44 = new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);
                  if (var31.size() > 0) {
                     String var46 = (String)var31.get(0);
                     com.aspose.cells.b.a.b.zt var47 = zbsq.b(var0, var46, var43.a().h());
                     var44.a(var44.b() + var47.b());
                     var44.b(var44.c() + var47.c());
                     String var50 = (String)var31.get(1);
                     com.aspose.cells.b.a.b.zt var52 = zbsq.b(var0, var50, var39);
                     var44.a(var44.b() + var52.b());
                     String var54 = (String)var31.get(2);
                     com.aspose.cells.b.a.b.zt var19 = zbsq.b(var0, var54, var43.a().h());
                     var44.a(var44.b() + var19.b());
                  }

                  float var48 = var12.c() / 4.0F;
                  if (var30.size() > 1) {
                     var12.b(var12.c() + var48);
                  }

                  float var49 = var44.c() / 4.0F;
                  if (var30.size() > 1) {
                     var44.b(var44.c() + var49);
                  }

                  float var51 = var12.b() > var44.b() ? var12.b() : var44.b();
                  float var53 = var12.c() + var44.c();
                  com.aspose.cells.b.a.b.zq var55 = new com.aspose.cells.b.a.b.zq(var4.a.d() - var51 - 8.0F, var4.a.e() - var53 / 2.0F, var51, var53);
                  if (var2) {
                     var55 = new com.aspose.cells.b.a.b.zq(var4.a.d() - var51 / 2.0F, var4.a.e() + 10.0F, var51, var53);
                  }

                  var43.a().b = com.aspose.cells.b.a.b.zp.a(var55);
                  var43.a().z();
                  com.aspose.cells.b.a.b.zq var56 = new com.aspose.cells.b.a.b.zq((float)var43.a().a.c(), (float)var43.a().a.d(), (float)var43.a().a.e(), (float)var43.a().a.f());
                  com.aspose.cells.b.a.b.zq[] var20 = new com.aspose.cells.b.a.b.zq[]{var56};
                  var4.d().e().a(var20);
                  var56 = var20[0];
                  var56.a(2.0F, 4.0F);
                  var43.a().c().a(var56);
                  var43.a().d().a(var56);
                  com.aspose.cells.b.a.b.zo var22 = var56.d();
                  float var23 = 0.0F;
                  float var24 = 0.0F;
                  if (var12.b() > var44.b()) {
                     var24 = (var12.b() - var44.b()) / 2.0F;
                  } else {
                     var23 = (var44.b() - var12.b()) / 2.0F;
                  }

                  String var25;
                  com.aspose.cells.b.a.b.zt var26;
                  String var27;
                  com.aspose.cells.b.a.b.zt var28;
                  String var29;
                  if (var30.size() > 0) {
                     if (var30.size() == 1) {
                        var0.a(var34, var43.a().h(), (com.aspose.cells.b.a.b.zc)(new com.aspose.cells.b.a.b.zu(var43.a().j())), (com.aspose.cells.b.a.b.zo)var22);
                     } else {
                        var22.a(var22.d() + var23);
                        var22.b(var22.e() + var48);
                        var25 = (String)var30.get(0);
                        var0.a(var25, var43.a().h(), (com.aspose.cells.b.a.b.zc)(new com.aspose.cells.b.a.b.zu(var43.a().j())), (com.aspose.cells.b.a.b.zo)var22);
                        var26 = zbsq.b(var0, var25, var43.a().h());
                        var22.a(var22.d() + var26.b());
                        var22.b(var22.e() - var48);
                        var27 = (String)var30.get(1);
                        var0.a(var27, var39, (com.aspose.cells.b.a.b.zc)(new com.aspose.cells.b.a.b.zu(var43.a().j())), (com.aspose.cells.b.a.b.zo)var22);
                        if (var30.size() > 2) {
                           var28 = zbsq.b(var0, var27, var39);
                           var22.a(var22.d() + var28.b());
                           var22.b(var22.e() + var48);
                           var29 = (String)var30.get(2);
                           var0.a(var29, var43.a().h(), (com.aspose.cells.b.a.b.zc)(new com.aspose.cells.b.a.b.zu(var43.a().j())), (com.aspose.cells.b.a.b.zo)var22);
                        }
                     }
                  }

                  if (var31.size() > 0) {
                     var22.a(var56.f());
                     var22.b(var56.g() + var12.c());
                     var22.a(var22.d() + var24);
                     var22.b(var22.e() + var49);
                     var25 = (String)var31.get(0);
                     var0.a(var25, var43.a().h(), (com.aspose.cells.b.a.b.zc)(new com.aspose.cells.b.a.b.zu(var43.a().j())), (com.aspose.cells.b.a.b.zo)var22);
                     var26 = zbsq.b(var0, var25, var43.a().h());
                     var22.a(var22.d() + var26.b());
                     var22.b(var22.e() - var49);
                     var27 = (String)var31.get(1);
                     var0.a(var27, var39, (com.aspose.cells.b.a.b.zc)(new com.aspose.cells.b.a.b.zu(var43.a().j())), (com.aspose.cells.b.a.b.zo)var22);
                     if (var31.size() > 2) {
                        var28 = zbsq.b(var0, var27, var39);
                        var22.a(var22.d() + var28.b());
                        var22.b(var22.e() + var49);
                        var29 = (String)var31.get(2);
                        var0.a(var29, var43.a().h(), (com.aspose.cells.b.a.b.zc)(new com.aspose.cells.b.a.b.zu(var43.a().j())), (com.aspose.cells.b.a.b.zo)var22);
                     }
                  }
               }
            } else {
               var5 = var4.r().s();
               zpu var6;
               com.aspose.cells.b.a.b.zs var8;
               com.aspose.cells.b.a.b.zp var9;
               com.aspose.cells.b.a.b.zq var10;
               if (var4.r().v()) {
                  var6 = var4.r();
                  new com.aspose.cells.b.a.b.zt((float)var4.d().e().a(), (float)var4.d().e().b());
                  var8 = new com.aspose.cells.b.a.b.zs(var6.a().l(), var6.a().m());
                  var9 = new com.aspose.cells.b.a.b.zp((int)var4.a.d() - var8.b() - 8, (int)var4.a.e() - var8.c() / 2, var8.b(), var8.c());
                  if (var2) {
                     var9 = new com.aspose.cells.b.a.b.zp((int)var4.a.d() - var8.b() / 2, (int)var4.a.e() + 10, var8.b(), var8.c());
                  }

                  var6.a().b = new com.aspose.cells.b.a.b.zp(var9.c(), var9.d(), var9.e(), var9.f());
                  var6.a().z();
                  var10 = new com.aspose.cells.b.a.b.zq((float)var6.a().a.c(), (float)var6.a().a.d(), (float)var6.a().l(), (float)var6.a().a.f());
                  a(var0, var10, var6);
               } else if (!"".equals(var5)) {
                  var6 = var4.r();
                  com.aspose.cells.b.a.b.zt var7 = new com.aspose.cells.b.a.b.zt((float)var4.d().e().a(), (float)var4.d().e().b());
                  var8 = zbsq.a(var0, var5, var6.m(), var6.a().h(), var7, var6.n(), var6.o());
                  var9 = new com.aspose.cells.b.a.b.zp((int)var4.a.d() - var8.b() - 8, (int)var4.a.e() - var8.c() / 2, var8.b(), var8.c());
                  if (var2) {
                     var9 = new com.aspose.cells.b.a.b.zp((int)var4.a.d() - var8.b() / 2, (int)var4.a.e() + 10, var8.b(), var8.c());
                  }

                  var6.a().b = new com.aspose.cells.b.a.b.zp(var9.c(), var9.d(), var9.e(), var9.f());
                  var6.a().z();
                  var10 = new com.aspose.cells.b.a.b.zq((float)var6.a().a.c(), (float)var6.a().a.d(), (float)var6.a().a.e(), (float)var6.a().a.f());
                  com.aspose.cells.b.a.b.zq[] var11 = new com.aspose.cells.b.a.b.zq[]{var10};
                  var4.d().e().a(var11);
                  var10 = var11[0];
                  var10.a(0.0F, 4.0F);
                  var6.a().c().a(var10);
                  var6.a().d().a(var10);
                  zpw.a(var0, var6, com.aspose.cells.b.a.b.zp.a(var10), var5, var6.m(), var6.a().h(), var6.a().j(), var6.n(), var6.o());
               }
            }
         }
      }

   }

   private static void a(zn var0, com.aspose.cells.b.a.b.zq var1, zpu var2) {
      zbai var3 = new zbai();
      var3.a(zbsq.a(var2.n()));
      var3.b(zbsq.a(var2.o()));
      zbaq var4 = new zbaq(var1, var3, var2.u(), var2.a().h());
      var4.b(var0);
   }

   private static String[] a(zig var0, double[] var1, zbtu var2) {
      boolean var3 = true;
      String var4 = "0.0000";
      if (!"".equals(var2.r().p())) {
         var4 = var2.r().p();
         var3 = false;
         if (var4.toLowerCase().equals("general")) {
            var4 = "0.0000";
            var3 = true;
         }
      }

      String[] var5 = new String[var1.length];

      for(int var6 = 0; var6 < var1.length; ++var6) {
         var5[var6] = zgc.a(var0.al(), Math.abs(var1[var6]), var4);
         if (var3) {
            double var7 = zbuk.a(var5[var6], var0.al());
            String[] var9;
            int var10;
            if (var7 == 0.0D) {
               var5[var6] = com.aspose.cells.a.c.zp.a(Math.abs(var1[var6]), "0.00E+00");
               var9 = com.aspose.cells.b.a.zv.d(var5[var6], 'E');
               if (var9.length > 1) {
                  var5[var6] = a(var9[0]) + "E";

                  for(var10 = 1; var10 < var9.length; ++var10) {
                     var5[var6] = var5[var6] + var9[var10];
                  }
               }
            } else if (Math.abs(var7) >= 1000000.0D) {
               var5[var6] = com.aspose.cells.a.c.zp.a(Math.abs(var1[var6]), "0E+00");
               var9 = com.aspose.cells.b.a.zv.d(var5[var6], 'E');
               if (var9.length > 1) {
                  var5[var6] = a(var9[0]) + "E";

                  for(var10 = 1; var10 < var9.length; ++var10) {
                     var5[var6] = var5[var6] + var9[var10];
                  }
               }
            } else {
               var5[var6] = a(var5[var6]);
            }
         }
      }

      return var5;
   }

   private static String a(String var0) {
      if (var0 != null && !"".equals(var0)) {
         char var1 = com.aspose.cells.b.a.ze.a(com.aspose.cells.b.a.c.zc.a().c());
         int var2 = var0.length() - 1;

         for(char var3 = var0.charAt(var2); var3 == '0' || var3 == var1; var3 = var0.charAt(var2)) {
            --var2;
            if (var2 < 0) {
               break;
            }
         }

         return var0.substring(0, 0 + var2 + 1);
      } else {
         return "";
      }
   }
}
